package com.pmcc.platform.shopping.repository;

import com.pmcc.platform.shopping.entity.Shopping;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import javax.persistence.Column;
import java.util.List;

public interface ShoppingRepository extends JpaRepository<Shopping,String> {

    Page<Shopping> findAllByDelFlagAndNameContainsAndPhoneContainsOrderByCreateTime(String delFlag,String name,String phone ,Pageable pageable);

    Shopping findAllByIdAndDelFlag(String id, String delFlag);

    Page<Shopping> findAllByShopIdAndDelFlag(String shopId,String delFlag, Pageable pageable);

    List<Shopping> findAllByShopIdAndDelFlag(String shopId,String delFLag);

    int countAllByDelFlag(String delFlag);

    List<Shopping>findAllByMiniUserIdAndDelFlag(String minUserId,String delFLag);

    List<Shopping> findAllByPhoneAndDelFlag(String phone,String delFlag);

    int countAllByShopIdAndDelFlag(String shopId,String delFlag);

    Page<Shopping> findAllBySalesmanIdAndDelFlagAndNameContainsOrderByCreateTime(String salesmanId,String delFlag,String field,Pageable pageable);

    Page<Shopping> findAllBySalesmanIdAndDelFlagAndPhoneContainsOrderByCreateTime(String salesmanId,String delFlag,String field,Pageable pageable);

    Page<Shopping> findAllBySalesmanIdAndDelFlagAndNameContainsAndPhoneContainsOrderByCreateTime(String salesmanId,String delFlag,String name,String field,Pageable pageable);




}
